# Maintainer: ovf <ovf@mm.st>
pkgname=fuzzylite
pkgver=6.0
pkgrel=0
pkgdesc="A fuzzy logic control library in C++"
url="https://fuzzylite.com"
# only used for vcmi revdep
arch="aarch64 x86_64"
license="GPL-3.0-only"
makedepends="cmake samurai"
subpackages="$pkgname-libs $pkgname-dev $pkgname-doc"
source="https://github.com/fuzzylite/fuzzylite/archive/refs/tags/v$pkgver/fuzzylite-$pkgver.tar.gz
	no-werror.patch
	"
builddir="$srcdir/fuzzylite-$pkgver/fuzzylite"

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake -B build -G Ninja \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DCMAKE_BUILD_TYPE=None \
		-DFL_BACKTRACE=OFF \
		-DFL_BUILD_STATIC=OFF \
		$CMAKE_CROSSOPTS
	cmake --build build
}

check() {
	ctest --test-dir build --output-on-failure
}

package() {
	DESTDIR="$pkgdir" cmake --install build
	install -Dm644 fuzzylite.1 -t "$pkgdir"/usr/share/man/man1/
}

sha512sums="
6f5d40d0359458e109ac2aebfbf571f61867a8b49920f4a5e1b5d86bdf578dba038b942c9e05eab0d4620f73e8cded770abe7b5e597a3b4c39dbcf6a1259f4af  fuzzylite-6.0.tar.gz
536439896cfae4bcfc93f7d3a8474424a3e589b55e3ae57c1ab8936d3166dea688ae8f6f0ef414a79238150822d811f0420a3849c94b33c5a7cd011e755bb95b  no-werror.patch
"
